package com.bocloud.cmp.dao;

import java.util.List;
import java.util.Map;

import com.bocloud.cmp.entity.resource.Room;
import com.bocloud.common.model.Param;
import com.bocloud.common.model.SimpleBean;
import com.bocloud.database.core.intf.GenericDao;

/**
 * 机房抽象DAO接口
 * 
 * @author wei wei
 * @version 1.0
 * @since 2016.02.27
 */
public interface RoomDao extends GenericDao<Room, Long> {

	/**
	 * 查询机房详细
	 * 
	 * @param id
	 *            the id
	 * @return the room
	 * @throws Exception
	 */
	public Room query(Long id) throws Exception;

	/**
	 * 查询当前页机房列表
	 * 
	 * @param page
	 *            the page
	 * @param rows
	 *            the rows
	 * @param params
	 *            the params
	 * @param sorter
	 *            the sorter
	 * @return the result
	 * @throws Exception
	 */
	public List<Room> list(int page, int rows, List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 查询机房简易列表
	 * 
	 * @param params
	 *            the params
	 * @param sorter
	 *            the sorter
	 * @return the bean
	 * @throws Exception
	 */
	public List<SimpleBean> list(List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 设置空闲机房
	 * 
	 * @param id
	 *            the id
	 * @param userId
	 *            the user id
	 * @return
	 * @throws Exception
	 */
	public boolean release(Long id, Long userId) throws Exception;

	/**
	 * 设置归属机房
	 * 
	 * @param id
	 *            the id
	 * @param dcId
	 *            the dataCenter id
	 * @param userId
	 *            the user id
	 * @return
	 * @throws Exception
	 */
	public boolean belong(Long id, Long dcId, Long userId) throws Exception;

	/**
	 * 查询空闲机房列表
	 * 
	 * @return the room list
	 * @throws Exception
	 */
	public List<Room> listFree() throws Exception;

	/**
	 * 查询符合条件的数据条数
	 * 
	 * @param params
	 *            the params
	 * @return count
	 * @throws Exception
	 */
	public int count(List<Param> params) throws Exception;

	/**
	 * 删除机房
	 * 
	 * @param id
	 *            the id
	 * @param userId
	 *            the user id
	 * @return
	 * @throws Exception
	 */
	public boolean remove(Long id, Long userId) throws Exception;
	
}
